package com.bw.zg3park2212.adpter

import android.widget.TextView
import com.bw.base.entity.MerchantEntityItem
import com.bw.zg3park2212.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class MerchantAdpter:BaseQuickAdapter<MerchantEntityItem,BaseViewHolder>(R.layout.item_merchant) {
    override fun convert(helper: BaseViewHolder, item: MerchantEntityItem) {
        helper.setText(R.id.merchant_time,item.entryTime)
        helper.setText(R.id.merchant_status,item.status)
        helper.setText(R.id.merchant_Name,item.enterpriseName)
        helper.setText(R.id.merchant_phone,item.contactMethod)
        helper.setText(R.id.merchant_area,""+item.applicationArea+"m²")
        val status = helper.getView<TextView>(R.id.merchant_status)
        if (item.status=="新建"){
            status.setBackgroundResource(R.drawable.bg_zganyong)
            status.setTextColor(context.resources.getColor(R.color.color_zhanyong))
        }else if(item.status=="驳回"){
            status.setBackgroundResource(R.drawable.bg_weihu)
            status.setTextColor(context.resources.getColor(R.color.color_weihu))
        }else{
            status.setBackgroundResource(R.drawable.shape_status)
            status.setTextColor(context.resources.getColor(R.color.color_kongxian))
        }
    }
}